package gen_b2g.game.bean;

import java.io.*;
import java.util.*;

import com.bowlong.util.*;

@SuppressWarnings({ "rawtypes", "unchecked" })
public class NIdOrKey extends com.bowlong.net.proto.N3Support {
    public static final int _CID = 1802856691;

    public int id; 
    public int key; 

    public NIdOrKey setNIdOrKey(int id,int key){
        this.id = id;
        this.key = key;
        return this;
    }

    public NIdOrKey(){}

    public NIdOrKey(int id,int key){
        this.id = id;
        this.key = key;
    }

    public NIdOrKey(NewMap map2) {
        this.id = map2.getInt(3355);
        this.key = map2.getInt(106079);
    }


    public Map _cacheResult;
    public Map toMap() {
        if(_cacheResult != null && !_cacheResult.isEmpty())
           return _cacheResult;
        Map r = new HashMap();
        r.put(-1, _CID);
        r.put(3355, id);
        r.put(106079, key);
        return r;
    }


    public static NIdOrKey parse(NewMap map2) {
        NIdOrKey r = new NIdOrKey(map2);
        return r;
    }


    public static NIdOrKey parse(NewMap map2, NIdOrKey r) {
        if(map2 == null) return null;

        r.id = map2.getInt(3355);
        r.key = map2.getInt(106079);
        return r;
    }

    public String toString() {
        return "NIdOrKey[id=" + id + ", key=" + key + "]";
    }

    public static NIdOrKey parse(byte[] buf) throws Exception {
        Map<Object, Object> map = com.bowlong.bio3.B3Helper.parseMap(buf);
        NewMap map2 = NewMap.create(map);
        return parse(map2);
    }

    public static NIdOrKey parse(InputStream in) throws Exception {
        Map<Object, Object> map = com.bowlong.bio3.B3Helper.parseMap(in);
        NewMap map2 = NewMap.create(map);
        return parse(map2);
    }

    public byte[] toByteArray() throws Exception {
        return com.bowlong.bio3.B3Helper.toBytes(toMap());
    }

}
